package com.polytech.dao;

import java.util.Collection;
import java.util.HashMap;

import com.polytech.beans.Color;

public class MemoryColorDao implements ColorDao {
	private HashMap<String, Color> colors=new HashMap<>();
	
	public MemoryColorDao() {
		insert(new Color("Noir", 0));
		insert(new Color("Bleu", 1));
		insert(new Color("Vert", 2));
		insert(new Color("Rose", 3));
		insert(new Color("Rouge", 4));
		insert(new Color("Marron", 6));
		insert(new Color("Gris", 7));
		insert(new Color("Orange", 8));
		insert(new Color("Violet", 12));
		insert(new Color("Jaune", 14));
		insert(new Color("Blanc", 15));
	}
	@Override
	public void insert(Color color) {
		colors.put(color.getName(), color);
	}
	@Override
	public Color select(String key) {
		return colors.get(key);
	}
	@Override
	public void remove(Color color) {
		colors.remove(color.getName());
	}
	@Override
	public Collection<Color> selectAll() {
		return colors.values();
	}

}
